// @ts-ignore
/* eslint-disable */
import request from '@/request'

/** 获取图片详情 获取指定图片的详细信息 GET /api/picture/${param0} */
export async function getPictureDetailUsingGet1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getPictureDetailUsingGET1Params,
  options?: { [key: string]: any }
) {
  const { pictureId: param0, ...queryParams } = params
  return request<API.Result>(`/api/picture/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 更新图片信息 更新指定图片的基本信息 PUT /api/picture/${param0} */
export async function updatePictureUsingPut1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updatePictureUsingPUT2Params,
  body: API.PictureUpdateDTO,
  options?: { [key: string]: any }
) {
  const { pictureId: param0, ...queryParams } = params
  return request<API.Result>(`/api/picture/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  })
}

/** 删除单张图片 删除指定的单张图片 DELETE /api/picture/${param0} */
export async function deletePictureUsingDelete1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deletePictureUsingDELETE2Params,
  options?: { [key: string]: any }
) {
  const { pictureId: param0, ...queryParams } = params
  return request<API.Result>(`/api/picture/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 审核通过单张图片 审核通过指定的单张图片 POST /api/picture/approve/${param0} */
export async function approvePictureUsingPost1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.approvePictureUsingPOST2Params,
  options?: { [key: string]: any }
) {
  const { pictureId: param0, ...queryParams } = params
  return request<API.Result>(`/api/picture/approve/${param0}`, {
    method: 'POST',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 批量审核通过图片 批量审核通过多张图片 POST /api/picture/approve/batch */
export async function batchApprovePicturesUsingPost1(
  body: API.PictureBatchApproveDTO,
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/picture/approve/batch', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** 批量删除图片 批量删除多张图片 DELETE /api/picture/batch */
export async function batchDeletePicturesUsingDelete1(
  body: API.PictureBatchDeleteDTO,
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/picture/batch', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** 获取图片分类列表 获取系统支持的所有图片分类 GET /api/picture/categories */
export async function getCategoriesUsingGet1(options?: { [key: string]: any }) {
  return request<API.Result>('/api/picture/categories', {
    method: 'GET',
    ...(options || {}),
  })
}

/** 下载图片 下载指定URL的图片 GET /api/picture/download */
export async function downloadImageUsingGet1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.downloadImageUsingGET1Params,
  options?: { [key: string]: any }
) {
  return request<any>('/api/picture/download', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  })
}

/** 编辑图片 编辑图片信息和内容 POST /api/picture/edit/${param0} */
export async function editPictureUsingPost1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.editPictureUsingPOST1Params,
  file?: File,
  tags?: string,
  category?: string,
  description?: string,
  options?: { [key: string]: any }
) {
  const { pictureId: param0, ...queryParams } = params
  const formData = new FormData()

  // 添加文件
  if (file) {
    formData.append('file', file)
  }

  // 添加其他参数
  if (tags) {
    formData.append('tags', tags)
  }
  if (category) {
    formData.append('category', category)
  }
  if (description) {
    formData.append('description', description)
  }

  return request<API.Result>(`/api/picture/edit/${param0}`, {
    method: 'POST',
    params: {
      ...queryParams,
    },
    data: formData,
    ...(options || {}),
  })
}

/** 获取图片列表 获取图片列表 GET /api/picture/list */
export async function getPictureListUsingGet1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getPictureListUsingGET2Params,
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/picture/list', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  })
}

/** 拒绝单张图片 拒绝指定的单张图片 POST /api/picture/reject/${param0} */
export async function rejectPictureUsingPost1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.rejectPictureUsingPOST2Params,
  body: API.PictureRejectDTO,
  options?: { [key: string]: any }
) {
  const { pictureId: param0, ...queryParams } = params
  return request<API.Result>(`/api/picture/reject/${param0}`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  })
}

/** 批量拒绝图片 批量拒绝多张图片 POST /api/picture/reject/batch */
export async function batchRejectPicturesUsingPost1(
  body: API.PictureBatchRejectDTO,
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/picture/reject/batch', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** 根据颜色搜索图片 根据指定的颜色值搜索相似颜色的图片 GET /api/picture/searchByColor/${param0} */
export async function searchByColorUsingGet1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.searchByColorUsingGET1Params,
  options?: { [key: string]: any }
) {
  const { color: param0, ...queryParams } = params
  return request<API.Result>(`/api/picture/searchByColor/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 获取图片统计数据 获取图片统计数据 GET /api/picture/statistics */
export async function getStatisticsUsingGet1(options?: { [key: string]: any }) {
  return request<API.Result>('/api/picture/statistics', {
    method: 'GET',
    ...(options || {}),
  })
}

/** 获取图片标签列表 获取系统支持的所有图片标签 GET /api/picture/tags */
export async function getTagsUsingGet1(options?: { [key: string]: any }) {
  return request<API.Result>('/api/picture/tags', {
    method: 'GET',
    ...(options || {}),
  })
}

/** 单个或批量上传图片 POST /api/picture/upload */
export async function uploadImagesUsingPost1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.uploadImagesUsingPOST1Params,
  body: {
    /** files */
    files: any[]
  },
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/picture/upload', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    params: {
      // isPublic has a default value: 1
      isPublic: '1',

      ...params,
    },
    data: body,
    ...(options || {}),
  })
}

/** 单个或批量上传视频 POST /api/vedio/upload */
export async function uploadVideosUsingPost1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.uploadVideosUsingPOST1Params,
  body: {
    /** file */
    file: File
    /** 分片大小（字节） */
    chunkSize?: number
    /** 当前分片索引 */
    chunkIndex?: number
    /** 总分片数 */
    totalChunks?: number
    /** 文件MD5值 */
    fileMd5?: string
  },
  options?: { [key: string]: any }
) {
  // 创建FormData
  const formData = new FormData()

  // 添加文件
  formData.append('file', body.file)

  // 添加分片相关参数
  if (body.chunkSize) formData.append('chunkSize', body.chunkSize.toString())
  if (body.chunkIndex !== undefined) formData.append('chunkIndex', body.chunkIndex.toString())
  if (body.totalChunks) formData.append('totalChunks', body.totalChunks.toString())
  if (body.fileMd5) formData.append('fileMd5', body.fileMd5)

  // 添加其他参数
  if (params.prefix) formData.append('prefix', params.prefix)
  if (params.category) formData.append('category', params.category)
  if (params.description) formData.append('description', params.description)
  if (params.isPublic !== undefined) formData.append('isPublic', params.isPublic.toString())
  if (params.tags) formData.append('tags', params.tags)

  return request<API.Result>('/api/vedio/upload', {
    method: 'POST',
    headers: {
      'Content-Type': 'multipart/form-data',
    },
    data: formData,
    ...(options || {}),
  })
}

/**
 * 获取AI生成的图片列表
 */
export const getAIPicturesUsingGet = (params: {
  page?: number
  pageSize?: number
  prompt?: string
  status?: string
}) => {
  return request<API.BaseResponsePagePictureVO>({
    url: '/api/ai/getAIPictures',
    method: 'GET',
    params,
  })
}

/**
 * 获取AI任务列表
 */
export const getAITasksUsingGet = (params: {
  page?: number
  pageSize?: number
  status?: string
}) => {
  return request<API.BaseResponsePageAITaskVO>({
    url: '/api/ai/getAiTasks',
    method: 'GET',
    params,
  })
}

/** 删除AI任务 DELETE /api/ai/del */
export const deleteAITasksUsingDelete = (params: { picIds: string }) => {
  return request<API.Result>('/api/ai/del', {
    method: 'POST',
    params: {
      ...params,
    },
  })
}

/** 爬取图片 GET /api/picture/crawler */
export const crawlerPicturesUsingGet = (params: { searchText: string; count: number }) => {
  return request<API.Result>('/api/picture/crawler', {
    method: 'GET',
    params: {
      ...params,
    },
  })
}

/** 批量收藏图片 POST /api/picture/favorite/batch */
export async function batchAddFavoriteUsingPost1(picIds: string, options?: { [key: string]: any }) {
  return request<API.Result>('/api/favoritepicture/favorite/batch', {
    method: 'POST',
    params: { picIds },
    ...(options || {}),
  })
}

/** 点赞图片 POST /api/picture/like */
export async function likePictureUsingPost1(
  picIds: string, // 逗号分隔的图片id字符串，和收藏接口一致
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/likepicture/like/batch', {
    method: 'POST',
    params: { picIds },
    ...(options || {}),
  })
}

/** 批量获取图片点赞/收藏状态 GET /api/picture/batch-like-favorite-status */
export async function getBatchLikeFavoriteStatusUsingGet(
  params: { picIds: string },
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/picture/batch-like-favorite-status', {
    method: 'GET',
    params,
    ...(options || {}),
  })
}

/** 批量取消收藏图片 POST /api/favoritepicture/cancel/batch */
export async function batchCancelFavoriteUsingPost1(
  picIds: string,
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/favoritepicture/cancel/batch', {
    method: 'POST',
    params: { picIds },
    ...(options || {}),
  })
}

/** 批量取消点赞图片 POST /api/likepicture/cancel/batch */
export async function cancelLikePictureUsingPost1(
  picIds: string,
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/likepicture/cancel/batch', {
    method: 'POST',
    params: { picIds },
    ...(options || {}),
  })
}

/** 获取当前用户点赞图片列表 GET /api/user/like/list */
export async function getLikePictureListUsingGet(params: any, options?: { [key: string]: any }) {
  return request<API.Result>('/api/likepicture//my-like/list', {
    method: 'GET',
    params,
    ...(options || {}),
  })
}

/** 获取当前用户收藏图片列表 GET /api/user/favorite/list */
export async function getFavoritePictureListUsingGet(
  params: any,
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/favoritepicture/list', {
    method: 'GET',
    params,
    ...(options || {}),
  })
}

/** 关键词搜索图片 GET http://localhost:8634/picture-es/searchByKeyword */
export async function searchPictureByKeywordUsingGet(
  params: { searchText: string; page?: number; pageSize?: number; type?: string },
  options?: { [key: string]: any }
) {
  return request<API.Result>('http://localhost:8634/picture-es/searchByKeyword', {
    method: 'GET',
    params: {
      ...params,
      type: 'all',
    },
    ...(options || {}),
  })
}

/** 获取图片热度排行 获取指定维度的图片热度排行 GET /api/picture/ranking */
export async function getPictureRankingUsingGet(
  params: {
    type?: 'total' | 'daily' | 'weekly' | 'monthly' // 排行类型
    category?: string // 分类筛选
    limit?: number // 返回数量限制
    page?: number
    pageSize?: number
  },
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/picture/ranking', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  })
}

/** 获取用户个性化推荐图片 基于用户兴趣推荐图片 GET /api/picture/recommend */
export async function getPersonalizedRecommendUsingGet(
  params: {
    userId?: string
    limit?: number // 推荐数量
    category?: string // 分类筛选
    page?: number
    pageSize?: number
  },
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/picture/recommend', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  })
}

/** 获取图片热度统计 获取图片的热度统计数据 GET /api/picture/statistics/heat */
export async function getPictureHeatStatisticsUsingGet(
  params: {
    pictureId?: string
    timeRange?: 'day' | 'week' | 'month' | 'year'
  },
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/picture/statistics/heat', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  })
}

/** 记录用户行为 记录用户的浏览、点赞、收藏等行为 POST /api/picture/user-behavior */
export async function recordUserBehaviorUsingPost(
  body: {
    pictureId: string
    userId: string
    behaviorType: 'view' | 'like' | 'favorite' | 'download' | 'share'
    timestamp?: number
  },
  options?: { [key: string]: any }
) {
  return request<API.Result>('/api/picture/user-behavior', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}
